#ifndef __max17043_H__
#define __max17043_H__
#include "main.h"


#if 1 
  #define max17043_DEBUG(format, args...) ESP_LOGW("[max17043]- "," %s:%d\r\n",__FILE__, __LINE__);printf(format, ## args );
#else
  #define max17043_DEBUG(format, args...) ;
#endif

#define MAX17043_CMD_WR 				0X64    	//写命令
#define MAX17043_CMD_RD 				0X65		//读命令

typedef struct
{
  char x[5];
	char y[5];
  uint8_t sta;
    
	  
}_max17043_data;
extern _max17043_data max17043_data;

#define MAX17043_VCELL          0x02
#define MAX17043_SOC            0x04
#define MAX17043_MODE           0x06
#define MAX17043_VERSION        0x08
#define MAX17043_CONFIG         0x0c
#define MAX17043_COMMAND        0xfe

esp_err_t max17043_init(void);
void  max17043_test_task(void *pvParameter);

u8 MAX17043_WR_Reg(u16 reg,u8 *buf,u8 len);
u8 MAX17043_RD_Reg(u16 reg,u8 *buf,u8 len);
float MAX17043_readPercentage();
float MAX17043_readVoltage();
void MAX17043_clearInterrupt();
void MAX17043_setInterrupt(uint8_t per);
void MAX17043_setSleep();
void MAX17043_setWakeUp();

#endif